package com.hanxiang.hankol.help
import androidx.annotation.NonNull;
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.baselibrary.bean.SelectSendFriend4Bean
import com.baselibrary.bean.ShareItemBean
import com.baselibrary.router.ActivityRouter
import com.baselibrary.utils.AppManager
import com.baselibrary.utils.UMShareUtils
import com.hankol.community.SelectFriendShareActivity
import com.hankol.community.ShareFriendActivity
import com.hankol.winecellar.arouter.WineryHelp
import com.hot.BridgeConstant
import com.media.publish.VideoEditActivity
import com.media.publish.service.UploadMediaService
import com.umeng.socialize.bean.SHARE_MEDIA


@Route(path = ActivityRouter.WINE_CELLAR.WINE_CELLAR_HELP)
class WineryHelpIml : WineryHelp {
    override fun getPublishStatus():Boolean {
        return UploadMediaService.isPublishing
    }

    override fun wxShare(activity: Activity, scene: Int, webpageUrl: String, title: String, desc: String, thumbnailUrl: String, shareType: Int) {
        UMShareUtils.shareImageNet(activity, if (scene == 0) SHARE_MEDIA.WEIXIN else SHARE_MEDIA.WEIXIN_CIRCLE, webpageUrl)
    }

    /**
     * @param activity
     * @param userId  0 则是私信好友界面
     * @param shareItemBean
     * @param selectSendFriend4Bean
     */
    override fun startShareFriend(activity: Activity, userId: Long, shareItemBean: ShareItemBean?, selectSendFriend4Bean: com.hankol.winecellar.bean.SelectSendFriend4Bean?) {
        val intent: Intent
        intent = if (userId == 0L) {
            Intent(activity, SelectFriendShareActivity::class.java)
        } else {
            Intent(activity, ShareFriendActivity::class.java)
        }
        if (shareItemBean != null) intent.putExtra("friend", shareItemBean)
        if (selectSendFriend4Bean != null) intent.putExtra("dynamic", selectSendFriend4Bean)
        activity.startActivity(intent)
    }

    @NonNull
    override fun getShareUrl(): String {
        return BridgeConstant.WINERY_SHARE_URL
    }

    override fun finishVideoEditActivity() {
         AppManager.getAppManager().finishActivity(VideoEditActivity::class.java)
    }

    override fun init(context: Context?) {
    }
}